
**************************************************************
* Create a dataset with predetermined parental characteristics  
**************************************************************

* Use sample of index workers and add parents X 2017
use Data/data_index_workers_X, clear
keep PersonId
merge 1:1 PersonId using Data\data_FamilyTree
keep if _merge == 3
drop _merge
drop MorMorId MorFarId FarMorId FarFarId

* Add mother´s X 
merge m:1 MorId using Data/data_mothers_X_2017
drop if _merge == 2
drop _merge

* Add father´s X 
merge m:1 FarId using Data/data_fathers_X_2017
drop if _merge == 2
drop _merge

drop MorId FarId

save  Data/data_Parents_X, replace
